﻿
@{
    ViewBag.Title = "QuejsList";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<style>
    .table-responsive {
        border: 0;
    }
</style>
<!--结算列表-->
<form id="tabGrid" style="margin:2px;margin-top:10px;">
    <div class="gridPanel" style="margin: 5px;">
        <table id="gridList" rel="tabGrid"></table>
    </div>
</form>
<script>

    $(function () {
        var jsdata = localStorage.getItem("jsdata");
        gridListFPH(JSON.parse(jsdata));
    });

    //加载结算列表
    function gridListFPH(mydata) {
        var $gridList = $("#gridList");
        $gridList.dataNewGrid({
            height: 150,
            colModel: [
                { label: '结算内码', width: 60, name: 'jsnm' },
                { label: 'flzffy', name: 'flzffy', hidden: true },
                { label: 'zffy', name: 'zffy', hidden: true },
                { label: 'jzfy', name: 'jzfy', hidden: true },
                { label: 'zlfy', name: 'zlfy', hidden: true },
                { label: 'xjzf', name: 'xjzf', hidden: true },
                { label: '姓名', name: 'xm', width: 70, align: 'left' },
                { label: '病历号', name: 'blh', width: 70, align: 'left' },
                {
                    label: '记账日期', name: 'CreateTime', width: 80, align: 'left', formatter: function (cellvalue) {
                        return cellvalue && cellvalue.length >= 10 ? cellvalue.substring(0, 10) : "";
                    }
                },
                { label: '操作人', name: 'czr', width: 70, align: 'left' },
                {
                    label: '总金额', name: 'zje', width: 80, align: 'left', formatter: function (cellvalue) {
                        return Number(cellvalue).toFixed(2);
                    }
                }
            ]
        }, mydata);
        if (mydata.length > 0) {
            $('.ui-jqgrid-bdiv').find(".unwritten").remove();
        }
    }


    //function submitForm() {
    //    btn_edit();
    //}
    //结算列表单击事件
    function btn_edit() {
        var data = $("#gridList").jqGridRowValue();
        if (data) {
            var seleRowid = jQuery("#gridList").jqGrid("getGridParam", "selrow");
            if (!(seleRowid)) {
                $.modalAlert("请选中一条信息", 'warning');
                return;
            }
            $.currentWindow().$("#blh").val(data.blh);
            $.currentWindow().getDetail(data.jsnm); //主页中的方法
            PatSearchConfirm();
        } else {
            $.modalAlert("当前无选中的数据！", "warning");
        }

    }

    //确定 主页面调用
    function PatSearchConfirm() {
        var $gridList = $("#gridList");
        var blh = $gridList.jqGridRowValue().blh;
        var xm = $gridList.jqGridRowValue().xm;
        var obj = new Object();
        obj.blh = blh;
        obj.xm = xm;
        //关闭窗口
        ReceiptCancle();
    }

    //取消
    function ReceiptCancle() {
        $.modalClose();
    }
</script>
